<template>

  <el-main>
    <el-table
        :data="list"
        style="width: 100%">
      <el-table-column
          prop="name"
          label="合同"
          width="120">
      </el-table-column>
      <el-table-column
          prop="total"
          label="合同金额"
          width="120">
      </el-table-column>
      <el-table-column
          prop="categoryId"
          label="合同类型"
          width="120">
      </el-table-column>
      <el-table-column
          prop="categoryId"
          label="合同状态"
          width="120">
        <template slot-scope="scope">
          <span v-if="scope.row.status=='0'">未提交</span>
          <span v-else="scope.row.status=='1'">已提交</span>
        </template>
      </el-table-column>
      <el-table-column
          prop="taskName"
          label="任务名称"
          width="120">
      </el-table-column>
      <el-table-column
          fixed
          prop="date"
          label="合同日期"
          width="150">
      </el-table-column>

      <el-table-column
          label="操作"
          width="200">
        <template slot-scope="scope" v-if="loginUserInfo.role='zhangsan'">
          <el-button @click="check(scope.row)" type="text" size="small" >审核</el-button>
        </template>
      </el-table-column>
    </el-table>
  </el-main>

</template>

<script>
export default {
  name: "HeTong",
  data() {
    return {
      list:[],
      loginUserInfo: {
        role:'zhangsan'
      }
    }
  },
  methods:{
    check(row) {
      this.axios.post('/hetong/activiti/check', row).then(res => {
        if (res.data.code == 200) {
          this.$message.success("审核通过了");
          this.mytask();
        }
      });
    },
    mytask() {
      this.axios.get("/hetong/activiti/mytask", {params: {userId: 1}}).then(res => {
        this.list = res.data.data;
      });
    }

  },
  created() {
    this.mytask();
  }
}
</script>

<style scoped>

</style>